<template>
  <div>
    <el-row type="flex" justify="start">
      <el-col :span="2" :offset="1">
        <h2>新增评定表</h2>
      </el-col>
      <el-col :span="2" :offset="18">
        <label style="color: red;font-size: 14px;line-height: 60px">清空该页面内容</label>
      </el-col>
    </el-row>

    <el-row style="height: auto;" type="flex" justify="center">
      <div class="elRow2" ref="elCol">
        <el-col :span="2" justify="center" style="align-content: flex-end;" :style="styleLabel">
          <label>评定表名称:</label>
        </el-col>
        <el-col :span="21" :style="styleLabel">
          <el-input v-model="formname" placeholder="输入评定表名称"/>
        </el-col>
      </div>
    </el-row>
    <br>
    <el-row style="height: auto;padding: 10px 0" type="flex" justify="start">
      <el-col :span="2" :offset="1" style="align-content: flex-end;">
        <span v-show="isEdit">{{ oneTitle.basicCondition }}</span>
        <input
          type="text"
          v-show="!isEdit"
          v-model="titleVal"
          ref="inputTitle"
          @blur="handleBlur"
        />
      </el-col>
      <el-col class="elCol1">
        <el-button @click="handleEdit" icon="el-icon-edit" type="text" size="medium"></el-button>
      </el-col>

      <!--          <el-col :span="18">
                  <el-input v-model="remark" placeholder="输入评定表的备注信息"/>
                </el-col>-->
    </el-row>

    <el-row style="height: auto;" type="flex" justify="center">
      <div class="elRow2">
        <el-col :span="2" :push="1">姓名:
          <el-input v-model="patientInfo.patientName"></el-input>
        </el-col>
        <el-col :span="2" :push="4">性别:
          <el-input v-model="patientInfo.patientGender"></el-input>
        </el-col>
        <el-col :span="2" :push="7">年龄:
          <el-input v-model="patientInfo.patientAge"></el-input>
        </el-col>
        <el-col :span="2" :push="10">科室:
          <el-input v-model="patientInfo.department"></el-input>
        </el-col>
        <el-col :span="2" :push="13">患者编号:
          <el-input v-model="patientInfo.patientId"></el-input>
        </el-col>
      </div>
    </el-row>

  </div>
</template>

<script>
export default {
  name: "componentAll",

  data() {
    return {
      formname:'',
      isEdit: true,
      titleVal: '',
      oneTitle: {
        basicCondition: '基本情况'
      },
      patientInfo: {
        patientId: '',
        patientName: '',
        patientAge: '',
        patientGender: '',
        department: ''
      },
      styleLabel: {
        lineHeight: '40px'
      },
    }
  },
  // watch:{
  //   formname(val){
  //     this.$bus.$emit('getComponentAl',val)
  //   }
  // },
  methods: {
    handleEdit() {
      this.isEdit = false
      this.$nextTick(() => {
        this.$refs.inputTitle.focus()
      })
    },
    handleBlur() {
      this.isEdit = true
      this.oneTitle.basicCondition = this.titleVal
    },
  },
  mounted() {
    // this.nextTick(()=>{
    //   this.$bus.$emit('getComponentAl',this.formname)
    // })
  }
}
</script>

<style scoped>
.elRow2 {
  border: 2px dashed #cccccc;
  border-radius: 10px;
  padding: 1em;
  width: 90%;
}

.elCol1 {
  margin-left: -50px;
  margin-top: -6px;
}
label {
  font-weight: normal;
}
</style>
